package yh;

/**
 * @Author:云尚
 * @Description:
 */
public class User5 {
    int id;
    String name;
    int age;
    //定义构造方法
    User5(int userId,String userName,int userAge){
        id = userId;
        name = userName;
        age = userAge;
    }
    //构造方法的重载
    User5(int userId,String userName){
        id = userId;
        name = userName;
    }

    User5(){

    }

    public static void main(String[] args) {
        //使用构造方法创建对象
        User5 user = new User5(1,"张三",21);
        //查看user信息
        System.out.println("id:"+user.id+",name:"+user.name+",age:"+user.age);

        //创建对象，查看用户信息
        User5 user2 = new User5(2,"李四");
        System.out.println("id:"+user2.id+",name:"+user2.name+",age:"+user2.age);

        //创建对象，查看用户信息
        User5 user3 = new User5();
        System.out.println("id:"+user3.id+",name:"+user3.name+",age:"+user3.age);
    }
}

